<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:ui="http://java.sun.com/jsf/facelets">
    <head>
        <title>Checkout</title>
    </head>
    <body>
        <h:form>
            <h:commandButton value="Logout" action="#{customerManager.logout}"/>
            <h:commandButton value="Calculate total amount" action="#{gnomeManager.showTotalCost()}"/>
        </h:form>
        <hr/>
        <h3>Pay for cart</h3>
        <hr/>
        <h:form>
            <p>
                <b>Total amount:</b> <h:outputText value="#{gnomeManager.totalAmount}" />
                <br/>
                <h:commandButton value="Pay for cart" action="#{gnomeManager.payForCart()}"/>

            </p>
        </h:form>
        <hr/>
        <h3>Shopping Cart</h3>
        <hr/>
            <h:form>
                <ui:repeat value="#{gnomeManager.shoppingCart}" var="gnome">
                    <li> 
                        <b>Type:</b> <h:outputText value="#{gnome.type.type}" />
                        <b>Price:</b> <h:outputText value="#{gnome.type.price}" />
                        <h:commandButton value="Remove from cart" action="#{gnomeManager.removeGnomeFromCart(gnome)}"/>
                    </li> 
                </ui:repeat>
            </h:form>
        <hr/>
    </body>
</html>
